package factoryMethod.product;

import factoryMethod.transport.Transport;
import factoryMethod.transport.boat;

/**
 * @ClassName boatProductLine
 * @Description TODO
 * @Author dalong
 * @Date 2020/6/27 11:45
 * @Version 1.0
 **/

public class boatProductLine extends ProductFactory {
    @Override
    public Transport getTransport() {
        return new boat();
    }

    @Override
    public <T extends Transport> T getTransport(Class<T> c) {
        Transport transport = null;

        try {
            transport = (Transport) Class.forName(c.getName()).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        return (T)transport;
    }
}
